<!DOCTYPE html>
<html>
<head>
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="jquery-1.10.2.js"></script>
<script language="javascript" type="text/javascript" src="tinymce.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.tinymce.min.js"></script>
<script language="javascript" type="text/javascript" src="tinymce.min.js"></script>
<script language="javascript" type="text/javascript" src="lrz/lrz/lrz.all.bundle.js"></script>

<!--
<script type="text/javascript">

tinymce.init({
  selector: "textarea",
  height:300,
  language:'zh_CN',
  // ===========================================
  // INCLUDE THE PLUGIN
  // ===========================================
  plugins: [
    "advlist autolink lists link image charmap print preview anchor",
    "searchreplace visualblocks code fullscreen",
    "insertdatetime media table contextmenu paste jbimages tinymcesmileybutton"
  ],

  // ===========================================
  // PUT PLUGIN'S BUTTON on the toolbar
  // ===========================================

  toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages tinymcesmileybutton",

  // ===========================================
  // SET RELATIVE_URLS to FALSE (This is required for images to display properly)
  // ===========================================

  relative_urls: false

});

</script>-->
<script type="text/javascript">
tinymce.init({

        selector: 'textarea',
        width: '100%',

        language:"zh_CN",

        plugins: [

                'advlist autolink lists link image charmap print preview anchor',                                       'searchreplace visualblocks code fullscreen textcolor colorpicker',

                 'insertdatetime media table contextmenu paste code'      ],

         toolbar: 'fullscreen preview | insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | forecolor mybutton backcolor',

          setup: function (editor) {

                   editor.addButton('mybutton', {

                        text: 'InsertImage',

                        icon: false,

                        onclick: function () {

                            tinymceEditor = editor;
                            $("input[name='upload-img']").click();
							app.selectFile();
                         }

                     });

                },

//TinyMCE 会将所有的 font 元素转换成 span 元素

convert_fonts_to_spans: true,

//换行符会被转换成 br 元素

convert_newlines_to_brs: false,

//在换行处 TinyMCE 会用 BR 元素而不是插入段落

force_br_newlines: false,

//当返回或进入 Mozilla/Firefox 时，这个选项可以打开/关闭段落的建立        force_p_newlines: false,

 //这个选项控制是否将换行符从输出的 HTML 中去除。选项默认打开，因为许多服务端系统将换行转换成，因为文本是在无格式的 textarea 中输入的。使用这个选项可以让所有内容在同一行。

remove_linebreaks: false,

//不能把这个设置去掉，不然图片路径会出错

relative_urls: false,

//允许拖动大小

resize: true,

 font_formats: "宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆;Arial=arial,helvetica,sans-serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",

 fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt"

});

function SetTinyMceContent(content)
{
    tinyMCE.editors[0].setContent(tinyMCE.editors[0].getContent()+content);
}
function GetTinyMceContent()
{
     var a1=tinyMCE.editors[0].getContent({format: 'raw'});//获取TinyMce的值
	 app.getHtmlEditorContent(a1);
}
</script>
<script type="text/javascript">
//自动全屏
 window.onload=function(){
      $('.mce-i-fullscreen').click();
	  $('#mceu_40-body').hide();
	  $('#mceu_41').hide();
	  $('#mceu_30-body').css("background-color","#fff");
	  $('.mce-widget').css("background-color","#fff");
	  $('.mce-btn').css("background-color","#fff");
	  $('.mce-toolbar-grp').css("padding","0 0");
	  $('#mceu_21-body').css("background-color","#fff");
	  $('#mceu_40').css("border-width","0 0 0");
		app.setHtmlEditorContent();
}
var imgurl = "";

function getImgURL(node) {
    var imgURL = "";
    try{
        var file = null;
        if(node.files && node.files[0] ){
            file = node.files[0];
        }else if(node.files && node.files.item(0)) {
            file = node.files.item(0);
        }
        //Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径
        try{
            //Firefox7.0
            imgURL =  file.getAsDataURL();
            //alert("//Firefox7.0"+imgRUL);
        }catch(e){
            //Firefox8.0以上
            imgRUL = window.URL.createObjectURL(file);
            //alert("//Firefox8.0以上"+imgRUL);
        }
     }catch(e){      //这里不知道怎么处理了，如果是遨游的话会报这个异常
        //支持html5的浏览器,比如高版本的firefox、chrome、ie10
        if (node.files && node.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                imgURL = e.target.result;
            };
            reader.readAsDataURL(node.files[0]);
        }
     }
    //imgurl = imgURL;
    creatImg(imgRUL);
    return imgURL;
}

function creatImg(imgRUL){   //根据指定URL创建一个Img对象
    var textHtml = "<img src='"+imgRUL+"'/>";
    $(".mark").after(textHtml);
}


</script>
<!-- /tinyMCE -->
</head>
<body style=" font-family: Microsoft YaHei, Tahoma;">
  <textarea></textarea>

</body>
</html>